package com.hgkj.system.auth;

import com.hgkj.system.service.SysMenuService;
import com.hgkj.system.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

/**
 * 用户权限
 */
@Component
public class SysPermissionService {

    @Autowired
    private SysRoleService sysRoleService;

    @Autowired
    private SysMenuService sysMenuService;

    /**
     * 根据userId获取角色集合
     * @param userId 用户ID
     * @return 角色集合
     */
    public List<String> getRolesByUserId(long userId) {
        return sysRoleService.getRolesByUserId(userId);
    }

    /**
     * 根据角色集合获取权限集合
     * @param roleList 角色集合
     * @return 权限集合
     */
    public Set<String> getPermsByRoles(List<String> roleList) {
        return sysMenuService.getPermsByRoles(roleList);
    }
}
